<%@ include file="/WEB-INF/pages/common/taglibs.jsp"%>
<html>
    <head>
        <meta http-equiv="Cache-Control" content="no-store"/>
        <meta http-equiv="Pragma" content="no-cache"/>
        <meta http-equiv="Expires" content="0"/>
        <link href="<c:url value='/styles/cl.css'/>" rel="stylesheet" type="text/css"/>
        <link href="<c:url value='/styles/site1.css'/>" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="<c:url value='/scripts/cl.js'/>"></script>
        <script type="text/javascript" src="<c:url value='/scripts/calendar.js'/>"></script>
        <script type="text/javascript" src="<c:url value='/scripts/validation.js'/>"></script>
        <script type="text/javascript">
            function addPrint(){
                var obj=document.getElementById("erecordModel.selectPageNum");
                if(window.opener.document.getElementById("erecordModel.printArray").value==""){
                    window.opener.document.getElementById("erecordModel.printArray").value=obj.value;
                }else if(!(checkStart(window.opener.document.getElementById("erecordModel.printArray").value,obj.value+";")||
                    window.opener.document.getElementById("erecordModel.printArray").value.indexOf(";"+obj.value+";")!=-1||
                    checkEnd(window.opener.document.getElementById("erecordModel.printArray").value,";"+obj.value))){
                    window.opener.document.getElementById("erecordModel.printArray").value=window.opener.document.getElementById("erecordModel.printArray").value+";"+obj.value;
                }
                window.opener.checkprintPages();
            }

            function removePrint(){
                var obj=document.getElementById("erecordModel.selectPageNum");
                if(window.opener.document.getElementById("erecordModel.printArray").value==obj.value){
                    window.opener.document.getElementById("erecordModel.printArray").value="";
                }else if(checkStart(window.opener.document.getElementById("erecordModel.printArray").value,obj.value+";")){
                    window.opener.document.getElementById("erecordModel.printArray").value=
                    window.opener.document.getElementById("erecordModel.printArray").value.substring(obj.value.length+1);
                }else if(checkEnd(window.opener.document.getElementById("erecordModel.printArray").value,";"+obj.value)){
                    window.opener.document.getElementById("erecordModel.printArray").value=
                    window.opener.document.getElementById("erecordModel.printArray").value.substring(0,window.opener.document.getElementById("erecordModel.printArray").value.length-obj.value.length-1);
                }else{
                    var index=window.opener.document.getElementById("erecordModel.printArray").value.indexOf(";"+obj.value+";");
                    if(index!=-1){
                        window.opener.document.getElementById("erecordModel.printArray").value=
                        window.opener.document.getElementById("erecordModel.printArray").value.substring(0,index)+
                        window.opener.document.getElementById("erecordModel.printArray").value.substring(index+1+obj.value.length);
                    }
                }
                window.opener.checkprintPages();
            }

            function subForm(obj){
                if(obj=="1"){
                    document.getElementById("erecordModel.selectPageNum").value="1";
                }else if(obj=="2"){
                    document.getElementById("erecordModel.selectPageNum").value=parseInt(<s:property value="erecordModel.selectPageNum"/>)-1;
                }else if(obj=="3"){
                    document.getElementById("erecordModel.selectPageNum").value=parseInt(<s:property value="erecordModel.selectPageNum"/>)+1;
                }else if(obj=="4"){
                   document.getElementById("erecordModel.selectPageNum").value=<s:property value="totalPageNum"/>;
                }
                if(isNaN(document.getElementById("erecordModel.selectPageNum").value)
                    ||parseInt(document.getElementById("erecordModel.selectPageNum").value)<=0
                    ||parseInt(document.getElementById("erecordModel.selectPageNum").value)>parseInt(<s:property value="totalPageNum"/>)){
                    alert('<s:text name="label.invalid.page"/>');
                    return;
                }
                document.forms[0].submit();
            }
        </script>
    </head>
<body>
<a href="<s:property value='#attr.erecordDetail'/>" id="viewDetailHref" target="embeddedDocument"></a>
<s:form name="viewDetailForm" action="viewPdfDetail.action" target="_self">
 <table width="100%">
    <tr class="even">
        <td class="txtData" align="right" width="100%">
            <input type="button" class="button" value="<s:text name='label.add.to.printlist'/>" onclick="addPrint();">
            <input type="button" class="button" value="<s:text name='label.remove.to.printlist'/>" onclick="removePrint();">
            &nbsp;&nbsp;&nbsp;
            <s:if test="erecordModel.selectPageNum==1">
                <img src='<s:url value="/images/ico_firstpage1.gif"/>' alt="First Page" title="First Page"/>
            </s:if>
            <s:else>
                <s:a href='javascript:subForm("1")'>
                    <img src='<s:url value="/images/ico_firstpage.gif"/>' alt="First Page" title="First Page"/>
                </s:a>
            </s:else>
            <s:if test="erecordModel.selectPageNum>1">
                <s:a href='javascript:subForm("2")'>
                    <img src='<s:url value="/images/ico_prevpage.gif"/>' alt="Previous Page" title="Previous Page"/>
                </s:a>
            </s:if>
            <s:else>
                   <img src='<s:url value="/images/ico_prevpage1.gif"/>' alt="Previous Page" title="Previous Page"/>
            </s:else>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <s:if test="erecordModel.selectPageNum<totalPageNum">
                <s:a href='javascript:subForm("3")'>
                    <img src='<s:url value="/images/ico_nextpage.gif"/>' alt="Next Page" title="Next Page"/>
                </s:a>
            </s:if>
            <s:else>
                    <img src='<s:url value="/images/ico_nextpage1.gif"/>' alt="Next Page" title="Next Page"/>
            </s:else>
            <s:if test="erecordModel.selectPageNum==totalPageNum">
                <img src='<s:url value="/images/ico_lastpage1.gif"/>' alt="Last Page" title="Last Page"/>
            </s:if>
            <s:else>
                <s:a href='javascript:subForm("4")'>
                   <img src='<s:url value="/images/ico_lastpage.gif"/>' alt="Last Page" title="Last Page"/>
                </s:a>
            </s:else>
            &nbsp;&nbsp;&nbsp;
            <s:text name="label.di"/>
            <s:textfield id="erecordModel.selectPageNum" name="erecordModel.selectPageNum" maxlength='4' size='4'/>
            <s:text name="label.ye"/>,<s:text name="label.gong"/><s:property value="totalPageNum"/><s:text name="label.ye"/>
            &nbsp;&nbsp;&nbsp;
            <input type="button" class="button" value="<s:text name='label.pagination.submit'/>" onclick="subForm();">
        </td>
    </tr>
</table>
</s:form>
<iframe id='embeddedDocument' name='embeddedDocument' width="100%" height="100%" scrolling="auto"></iframe>
</body>

<script type="text/javascript">
   document.getElementById("viewDetailHref").click();
</script>
</html>



